gStreamHud = {}
gStreamHud.Text = "No Song Currently Playing"
gStreamHud.Mid = ScrW() / 2
gStreamHud.Wid = 200
gStreamHud.Width = gStreamHud.Wid + 20
surface.SetFont("TabLarge")
timer.Remove("Counter")


function gStreamHud.Paint()
// START OF THE NAME THING//\
surface.SetFont("TabLarge")
gStreamHud.Wid,gStreamHud.Hei = surface.GetTextSize(gStreamHud.Text)
	surface.SetDrawColor(180,180,180,230)
		surface.DrawRect(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)),10,gStreamHud.Width,20)
	surface.SetDrawColor(10,10,10,230)
		surface.DrawOutlinedRect(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)),10,gStreamHud.Width,20)
	draw.SimpleText(gStreamHud.Text, "TabLarge",gStreamHud.Mid , 20, Color(255,255,255,255),1,1)
end

function gStreamHud.PaintBar()
// PROGRESS BAR BACKGROUND//
	surface.SetDrawColor(180,180,180,230)
		surface.DrawRect(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)),32,gStreamHud.Width,25)
	surface.SetDrawColor(10,10,10,230)
		surface.DrawOutlinedRect(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)),32,gStreamHud.Width,25)
//PROGRESS BAR FOREGROUND//
	surface.SetDrawColor(10,10,10,230)
		surface.DrawRect(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)) + 2,34,gStreamHud.Pos - 4,21)
	surface.SetFont("DefaultSmallDropShadow")
	local wid, hei = surface.GetTextSize(gStreamHud.Timer.." ")
	if gStreamHud.Pos < wid + 5 then
		surface.SetTextPos(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)) + 5,44)
	else
		surface.SetTextPos(math.ceil((gStreamHud.Mid - (gStreamHud.Width / 2)) + ((gStreamHud.Pos - wid)-2)),44)
	end
	surface.SetTextColor(250,250,250,255)
	surface.DrawText(gStreamHud.Timer)
end

function gStreamHud.GetSong(Name,Len)
	gStreamHud.Pos = 0
	gStreamHud.Minz = 0
	gStreamHud.Secz = 0
	gStreamHud.Min = 0
	gStreamHud.Sec = 0
	gStreamHud.i = 0
	gStreamHud.Timer = "00:00"
	gStreamHud.Text = Name.." ("..Len..")"
	surface.SetFont("TabLarge")
	gStreamHud.Wid,gStreamHud.Hei = surface.GetTextSize(gStreamHud.Text)
	if gStreamHud.Wid < 200 then
		gStreamHud.Wid = 200
	end
	gStreamHud.Width = gStreamHud.Wid + 20
	local Splodey = string.Explode(":",Len)
	gStreamHud.ToSec = (Splodey[2] + (Splodey[1]*60))
	timer.Create("Counter", 1, 0, gStreamHud.Count)
	hook.Add("HUDPaint", "DrawBar", gStreamHud.PaintBar)
end

function gStreamHud.Count()
	if gStreamHud.i < gStreamHud.ToSec then
		if 	gStreamHud.Secz == 59 then
			gStreamHud.Minz = gStreamHud.Minz + 1
			gStreamHud.Secz = -1
		end
		gStreamHud.Secz = gStreamHud.Secz + 1
		if gStreamHud.Minz < 10 then
			gStreamHud.Min = "0"..gStreamHud.Minz
		else
			gStreamHud.Min = gStreamHud.Minz
		end
		if gStreamHud.Secz < 10 then
			gStreamHud.Sec = "0"..gStreamHud.Secz
		else
			gStreamHud.Sec = gStreamHud.Secz
		end
		gStreamHud.Timer = gStreamHud.Min..":"..gStreamHud.Sec
		gStreamHud.Pos = gStreamHud.Pos + ((gStreamHud.Width) / gStreamHud.ToSec)
	else 
		if gStreamHud.i == gStreamHud.ToSec + 5 then
			gStreamHud.Text = "No Song Currently Playing"
			timer.Remove("Counter")
			hook.Remove("HUDPaint","DrawBar")
		end
	end
	gStreamHud.i = gStreamHud.i + 1
end

hook.Add("HUDPaint", "DrawHud", gStreamHud.Paint)